package com.example.demo.vo

import com.example.demo.dao.TDoctorDao
import com.example.demo.dao.TPatientDao
import com.example.demo.dbmodels.TDoctor
import me.liuwj.ktorm.dsl.QueryRowSet
import java.math.BigDecimal
import java.time.LocalDateTime

class DoctorVo {


    /**
     *  医生ID
     **/
    var id: Int? = null
    /**
     *  病区编号
     **/
    var district_code: String? = null
    /**
     *  科室编号
     **/
    var dept_code: String? = null
    /**
     *  工号
     **/
    var code: String? = null
    /**
     *  用户ID
     **/
    var user_id: Int? = null
    /**
     *  医生名称
     **/
    var name: String? = null
    /**
     *  性别（0-男、1-女、2-未知）
     **/
    var sex: Int? = null
    /**
     *  婚姻情况(0-未婚、1-已婚、2-未知)
     **/
    var marriage: Int? = null
    /**
     *  出生日期
     **/
    var birthday: LocalDateTime? = null
    /**
     *  行政区代码
     **/
    var pca_code: Int?= null
    /**
     *  地址
     **/
    var address: String? = null
    /**
     *  邮政编码
     **/
    var post_code: String? = null
    /**
     *  手机号码
     **/
    var mobile: String? = null
    /**
     *  简介
     **/
    var intro: String? = null
    /**
     *  是否专家（0-否、1-是）
     **/
    var is_expert: Int? = null
    /**
     *  特长
     **/
    var specialty: String? = null
    /**
     *  区域编码
     **/
    var area_code: String? = null
    /**
     *  学历
     **/
    var education: String? = null
    /**
     *  职称
     **/
    var title: String? = null
    /**
     *  社会机构及职务
     **/
    var duties: String? = null
    /**
     *  机构编码
     **/
    var org_code: String? = null
    /**
     *  证件号码
     **/
    var id_number: String? = null
    /**
     *  证书编号
     **/
    var certificate_no: String? = null
    /**
     *  证件图片
     **/
    var id_url: String? = null
    /**
     *  认证状态（0-未认证、1-已通过、2-未通过、3-驳回）
     **/
    var check_state: Int? = null
    /**
     *  签名图片URL
     **/
    var signature_url: String? = null
    /**
     *  手持证件图片
     **/
    var handheld_id_url: String? = null
    /**
     *  医师执业证书图片
     **/
    var certificate_url: String? = null
    /**
     *  医生图像图片
     **/
    var image_url: String? = null
    /**
     *  BJCA医生唯一标识
     **/
    var open_id: String? = null
    /**
     *  身高
     **/
    var height: BigDecimal? = null
    /**
     *  体重
     **/
    var weight: BigDecimal? = null
    /**
     *  BPM指数
     **/
    var bpm: String? = null
    /**
     *  挂号金额
     **/
    var guo_hao_money: Int? = null
    /**
     *  排序
     **/
    var sort: Int?= null
    /**
     *  状态1=有效，0=无效
     **/
    var status: Int? = null
    /**
     *  备注
     **/
    var remark: String? = null
    /**
     *  更新时间
     **/
    var update_time: LocalDateTime? = null
    /**
     *  更新人
     **/
    var update_by: Int? = null
    /**
     *  删除标记
     **/
    var is_del: Boolean? = null


    fun getDoctorVo(queue: QueryRowSet): DoctorVo {

        queue.let {
            val data = DoctorVo()
            data.address = it[TDoctorDao.address]
            data.area_code = it[TDoctorDao.area_code]
//            data.birthday =  it[TDoctorDao.bir]
            data.bpm =  it[TDoctorDao.bpm]
            data.certificate_no = it[TDoctorDao.certificate_no]
            data.certificate_url =  it[TDoctorDao.certificate_url]
            data.check_state =  it[TDoctorDao.check_state]
            data.code =  it[TDoctorDao.code]
            data.dept_code =  it[TDoctorDao.dept_code]
            data.district_code =  it[TDoctorDao.district_code]
            data.duties = it[TDoctorDao.duties]
            data.education = it[TDoctorDao.education]
            data.guo_hao_money = it[TDoctorDao.guo_hao_money]
            data.handheld_id_url =  it[TDoctorDao.handheld_id_url]
            data.height = it[TDoctorDao.height]
            data.id =  it[TDoctorDao.id]
            data.id_number = it[TDoctorDao.id_number]
            data.id_url =  it[TDoctorDao.id_url]
            data.image_url = it[TDoctorDao.image_url]
            data.intro = it[TDoctorDao.intro]
            data.is_del = it[TDoctorDao.is_del]
            data.is_expert = it[TDoctorDao.is_expert]
            data.marriage = it[TDoctorDao.marriage]
            data.open_id =  it[TDoctorDao.open_id]
            data.mobile = it[TDoctorDao.mobile]
            data.name =   it[TDoctorDao.name]
            return  data
        }

    }

    fun getDoctorVo(table:TDoctor):DoctorVo{
        table.let {
            val data = DoctorVo()
            data.address = it.address
            data.area_code = it.area_code
            data.birthday = it.birthday
            data.bpm = it.bpm
            data.certificate_no = it.certificate_no
            data.certificate_url = it.certificate_url
            data.check_state = it.check_state
            data.code = it.code
            data.dept_code = it.dept_code
            data.district_code = it.district_code
            data.duties = it.duties
            data.education = it.education
            data.guo_hao_money = it.guo_hao_money
            data.handheld_id_url = it.handheld_id_url
            data.height = it.height
            data.id = it.id
            data.id_number = it.id_number
            data.id_url = it.id_url
            data.image_url = it.image_url
            data.intro = it.intro
            data.is_del = it.is_del
            data.is_expert = it.is_expert
            data.marriage = it.marriage
            data.open_id = it.open_id
            data.mobile = it.mobile
            data.name = it.name
            return  data
        }
    }


    fun getDoctorVoList(table:List<TDoctor>?):List<DoctorVo>?{
        table?.let {
            val doctorVoList = mutableListOf<DoctorVo>()
            table?.forEach {
                val data = DoctorVo()
                data.address = it.address
                data.area_code = it.area_code
                data.birthday = it.birthday
                data.bpm = it.bpm
                data.certificate_no = it.certificate_no
                data.certificate_url = it.certificate_url
                data.check_state = it.check_state
                data.code = it.code
                data.dept_code = it.dept_code
                data.district_code = it.district_code
                data.duties = it.duties
                data.education = it.education
                data.guo_hao_money = it.guo_hao_money
                data.handheld_id_url = it.handheld_id_url
                data.height = it.height
                data.id = it.id
                data.id_number = it.id_number
                data.id_url = it.id_url
                data.image_url = it.image_url
                data.intro = it.intro
                data.is_del = it.is_del
                data.is_expert = it.is_expert
                data.marriage = it.marriage
                data.open_id = it.open_id
                data.mobile = it.mobile
                data.name = it.name
               doctorVoList.add(data)
            }
            return  doctorVoList
        }
        return  null
    }


}